module.exports = async function globalTeardown() {
  console.log('🧹 清理全局测试环境...');
  
  const testDataSource = global.__TEST_DATA_SOURCE__;
  
  if (testDataSource && testDataSource.isInitialized) {
    try {
      await testDataSource.destroy();
      console.log('✅ 测试数据库连接已关闭');
    } catch (error) {
      console.error('❌ 关闭测试数据库连接失败:', error);
    }
  }
};
